<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <canvas id="canvas" height="600" width="700"></canvas>
  <script>
    const canvas = document.getElementById('canvas')
    const ctx = canvas.getContext('2d')
    // 从左向右绘制：
    ctx.beginPath()
    ctx.font = '40px Verdana'
    ctx.textAlign = 'center'
    ctx.lineWidth = 1.6
    ctx.direction = 'ltr'
    ctx.strokeText('Hello Canvas !', 350, 220, 400)
    ctx.closePath()
    // 从右向左绘制：
    ctx.beginPath()
    ctx.direction = 'rtl'
    ctx.strokeText('Hello Canvas !', 350, 380, 400)
  </script>
</body>

</html>